﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using Servidor.WebServices;
using TiposComuns.Objectos;
using System.Windows.Forms;
using System.Net;
using System.Threading;
using System.Diagnostics;
using PADIbook;

namespace PadibookConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Iniciar servidores (username,porta):");
            try
            {
                //Console.WriteLine("username: " + s[0] + " porta: " + s[1]);
                string arg = Console.ReadLine();
                string serv;
                for (int id = 1; id < 4; id++)
                {
                    serv = arg + "," + id;
                    Process.Start("Servidor.exe",serv);
                    Console.WriteLine("Iniciei o servidor "+id);
                    if(id<3) Thread.Sleep(15000);
                }
                
                
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
                Console.WriteLine("Iniciei o cliente.");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine("Tente novamente! "+e.Message);
            }
                        
        }

        
    }
}
